import React, { Component } from 'react'
import Child from './Child'
import { root } from './index'

export default class App extends Component {
  state = {
    num: 0,
  }
  handleClick = () => {
    // this.setState({ num: this.state.num + 1 })
    // ReactDOM.unmountComponentAtNode(document.getElementById('root'))
    root.unmount()
  }
  render() {
    return (
      <div>
        App
        <button onClick={this.handleClick}>+1</button>
        <hr />
        {this.state.num % 2 === 0 ? <Child /> : null}
      </div>
    )
  }
}
